home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / Menus.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  39.4 KB  |  1,210 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        Menus.h
  3.  
  4.      Contains:    Menu Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 9.0
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1985-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __MENUS__
  18. #define __MENUS__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __EVENTS__
  25.     #include <Events.h>
  26. #endif
  27.  
  28. #ifndef __QUICKDRAW__
  29.     #include <Quickdraw.h>
  30. #endif
  31.  
  32. #ifndef __FONTS__
  33.     #include <Fonts.h>
  34. #endif
  35.  
  36. #ifndef __TEXTCOMMON__
  37.     #include <TextCommon.h>
  38. #endif
  39.  
  40. #ifndef __PROCESSES__
  41.     #include <Processes.h>
  42. #endif
  43.  
  44. #ifndef __APPLEEVENTS__
  45.     #include <AppleEvents.h>
  46. #endif
  47.  
  48. #ifndef __COLLECTIONS__
  49.     #include <Collections.h>
  50. #endif
  51.  
  52. #ifndef __MACERRORS__
  53.     #include <MacErrors.h>
  54. #endif
  55.  
  56.  
  57.  
  58. #if PRAGMA_ONCE
  59. #pragma once
  60. #endif
  61.  
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65.  
  66. #if PRAGMA_IMPORT
  67. #pragma import on
  68. #endif
  69.  
  70. #if PRAGMA_STRUCT_ALIGN
  71.     #pragma options align=mac68k
  72. #elif PRAGMA_STRUCT_PACKPUSH
  73.     #pragma pack(push, 2)
  74. #elif PRAGMA_STRUCT_PACK
  75.     #pragma pack(2)
  76. #endif
  77.  
  78.  
  79. /*--------------------------------------------------------------------------------------*/
  80. /*    o Menu Constants                                                                     */
  81. /*--------------------------------------------------------------------------------------*/
  82. enum {
  83.     noMark                        = 0                                /*mark symbol for MarkItem*/
  84. };
  85.  
  86. enum {
  87.                                                                 /* menu defProc messages */
  88.     kMenuDrawMsg                = 0,
  89.     kMenuSizeMsg                = 2,
  90.     kMenuPopUpMsg                = 3,
  91.     kMenuCalcItemMsg            = 5,
  92.     kMenuThemeSavvyMsg            = 7,                            /* is your MDEF theme-savvy?  If so, return hex 7473 in the whichItem parameter*/
  93.     mDrawMsg                    = 0,
  94.     mSizeMsg                    = 2,
  95.     mPopUpMsg                    = 3,                            /* position the popup menu rect appropriately */
  96.     mCalcItemMsg                = 5
  97. };
  98.  
  99. #if CALL_NOT_IN_CARBON
  100. /*
  101.    Carbon MDEFs must replace mChooseMsg with the new messages kMenuFindItemMsg and kMenuHiliteItemMsg. 
  102.    mDrawItemMsg was used by the popup menu control before 8.5, but is no longer used. 
  103. */
  104. enum {
  105.     mChooseMsg                    = 1,
  106.     mDrawItemMsg                = 4,
  107.     kMenuChooseMsg                = 1,
  108.     kMenuDrawItemMsg            = 4
  109. };
  110.  
  111. #endif  /* CALL_NOT_IN_CARBON */
  112.  
  113. enum {
  114.     kThemeSavvyMenuResponse        = 0x7473
  115. };
  116.  
  117. /* these MDEF messages are only supported in Carbon*/
  118. enum {
  119.     kMenuInitMsg                = 8,
  120.     kMenuDisposeMsg                = 9,
  121.     kMenuFindItemMsg            = 10,
  122.     kMenuHiliteItemMsg            = 11
  123. };
  124.  
  125. enum {
  126.     textMenuProc                = 0,
  127.     hMenuCmd                    = 27,                            /*itemCmd == 0x001B ==> hierarchical menu*/
  128.     hierMenu                    = -1,                            /*a hierarchical menu - for InsertMenu call*/
  129.     kInsertHierarchicalMenu        = -1,                            /*a better name for hierMenu */
  130.     mctAllItems                    = -98,                            /*search for all Items for the given ID*/
  131.     mctLastIDIndic                = -99                            /*last color table entry has this in ID field*/
  132. };
  133.  
  134. /* Constants for use with MacOS 8.0 (Appearance 1.0) and later*/
  135. enum {
  136.     kMenuStdMenuProc            = 63,
  137.     kMenuStdMenuBarProc            = 63
  138. };
  139.  
  140. enum {
  141.     kMenuNoModifiers            = 0,                            /* Mask for no modifiers*/
  142.     kMenuShiftModifier            = (1 << 0),                        /* Mask for shift key modifier*/
  143.     kMenuOptionModifier            = (1 << 1),                        /* Mask for option key modifier*/
  144.     kMenuControlModifier        = (1 << 2),                        /* Mask for control key modifier*/
  145.     kMenuNoCommandModifier        = (1 << 3)                        /* Mask for no command key modifier*/
  146. };
  147.  
  148. enum {
  149.     kMenuNoIcon                    = 0,                            /* No icon*/
  150.     kMenuIconType                = 1,                            /* Type for ICON*/
  151.     kMenuShrinkIconType            = 2,                            /* Type for ICON plotted 16 x 16*/
  152.     kMenuSmallIconType            = 3,                            /* Type for SICN*/
  153.     kMenuColorIconType            = 4,                            /* Type for cicn*/
  154.     kMenuIconSuiteType            = 5,                            /* Type for Icon Suite*/
  155.     kMenuIconRefType            = 6                                /* Type for Icon Ref*/
  156. };
  157.  
  158. enum {
  159.     kMenuAttrExcludesMarkColumn    = (1 << 0),                        /* No space is allocated for the mark character */
  160.     kMenuAttrAutoDisable        = (1 << 2)                        /* Menu title is automatically disabled when all items are disabled */
  161. };
  162.  
  163. typedef OptionBits                         MenuAttributes;
  164. enum {
  165.     kMenuItemAttrSubmenuParentChoosable = (1 << 2)                /* Parent item of a submenu is still selectable by the user */
  166. };
  167.  
  168. typedef OptionBits                         MenuItemAttributes;
  169.  
  170. typedef UInt32 MenuTrackingMode;
  171. enum {
  172.     kMenuTrackingModeMouse        = 1,                            /* Menus are being tracked using the mouse*/
  173.     kMenuTrackingModeKeyboard    = 2                                /* Menus are being tracked using the keyboard*/
  174. };
  175.  
  176. /*--------------------------------------------------------------------------------------*/
  177. /*    o Menu Types                                                                         */
  178. /*--------------------------------------------------------------------------------------*/
  179. typedef SInt16                             MenuID;
  180. typedef UInt16                             MenuItemIndex;
  181. typedef UInt32                             MenuCommand;
  182. #if !OPAQUE_TOOLBOX_STRUCTS
  183.  
  184. struct MenuInfo {
  185.     MenuID                             menuID;
  186.     short                             menuWidth;
  187.     short                             menuHeight;
  188.     Handle                             menuProc;
  189.     long                             enableFlags;
  190.     Str255                             menuData;
  191. };
  192. typedef struct MenuInfo                    MenuInfo;
  193.  
  194. typedef MenuInfo *                        MenuPtr;
  195. typedef MenuPtr *                        MenuHandle;
  196. #else
  197. typedef struct OpaqueMenuHandle*         MenuHandle;
  198. #endif  /* !OPAQUE_TOOLBOX_STRUCTS */
  199.  
  200. /* MenuRef and MenuHandle are equivalent. Use either. We don't care.*/
  201. typedef MenuHandle                         MenuRef;
  202.  
  203. struct MCEntry {
  204.     MenuID                             mctID;                        /*menu ID.  ID = 0 is the menu bar*/
  205.     short                             mctItem;                    /*menu Item. Item = 0 is a title*/
  206.     RGBColor                         mctRGB1;                    /*usage depends on ID and Item*/
  207.     RGBColor                         mctRGB2;                    /*usage depends on ID and Item*/
  208.     RGBColor                         mctRGB3;                    /*usage depends on ID and Item*/
  209.     RGBColor                         mctRGB4;                    /*usage depends on ID and Item*/
  210.     short                             mctReserved;                /*reserved for internal use*/
  211. };
  212. typedef struct MCEntry                    MCEntry;
  213. typedef MCEntry *                        MCEntryPtr;
  214.  
  215. typedef MCEntry                         MCTable[1];
  216. typedef MCEntry *                        MCTablePtr;
  217. typedef MCTablePtr *                    MCTableHandle;
  218.  
  219. struct MenuCRsrc {
  220.     short                             numEntries;                    /*number of entries*/
  221.     MCTable                         mcEntryRecs;                /*ARRAY [1..numEntries] of MCEntry*/
  222. };
  223. typedef struct MenuCRsrc                MenuCRsrc;
  224. typedef MenuCRsrc *                        MenuCRsrcPtr;
  225. typedef MenuCRsrcPtr *                    MenuCRsrcHandle;
  226. #if TARGET_OS_WIN32
  227. /* QuickTime 3.0 */
  228.  
  229. struct MenuAccessKeyRec {
  230.     short                             count;
  231.     long                             flags;
  232.     unsigned char                     keys[1];
  233. };
  234. typedef struct MenuAccessKeyRec            MenuAccessKeyRec;
  235.  
  236. typedef MenuAccessKeyRec *                MenuAccessKeyPtr;
  237. typedef MenuAccessKeyPtr *                MenuAccessKeyHandle;
  238. EXTERN_API_C( void )
  239. SetMenuItemHotKey                (MenuRef                 menu,
  240.                                  short                     itemID,
  241.                                  char                     hotKey,
  242.                                  long                     flags);
  243.  
  244. #endif  /* TARGET_OS_WIN32 */
  245.  
  246.  
  247. struct MenuTrackingData {
  248.     MenuRef                         menu;
  249.     MenuItemIndex                     itemSelected;
  250.     MenuItemIndex                     itemUnderMouse;
  251.     Rect                             itemRect;
  252.     SInt32                             virtualMenuTop;
  253.     SInt32                             virtualMenuBottom;
  254. };
  255. typedef struct MenuTrackingData            MenuTrackingData;
  256. typedef MenuTrackingData *                MenuTrackingDataPtr;
  257.  
  258. struct HiliteMenuItemData {
  259.     MenuItemIndex                     previousItem;
  260.     MenuItemIndex                     newItem;
  261. };
  262. typedef struct HiliteMenuItemData        HiliteMenuItemData;
  263. typedef HiliteMenuItemData *            HiliteMenuItemDataPtr;
  264. /*--------------------------------------------------------------------------------------*/
  265. /*    o Menu ProcPtrs                                                                     */
  266. /*                                                                                        */
  267. /*    All of these procs are considered deprecated.  Developers interested in portability    */
  268. /*    to Carbon should avoid them entirely, if at all possible.                            */
  269. /*--------------------------------------------------------------------------------------*/
  270. typedef CALLBACK_API( void , MenuDefProcPtr )(short message, MenuRef theMenu, Rect *menuRect, Point hitPt, short *whichItem);
  271. typedef STACK_UPP_TYPE(MenuDefProcPtr)                             MenuDefUPP;
  272. #if OPAQUE_UPP_TYPES
  273.     EXTERN_API(MenuDefUPP)
  274.     NewMenuDefUPP                   (MenuDefProcPtr            userRoutine);
  275.  
  276.     EXTERN_API(void)
  277.     DisposeMenuDefUPP               (MenuDefUPP                userUPP);
  278.  
  279.     EXTERN_API(void)
  280.     InvokeMenuDefUPP               (short                    message,
  281.                                     MenuRef                    theMenu,
  282.                                     Rect *                    menuRect,
  283.                                     Point                    hitPt,
  284.                                     short *                    whichItem,
  285.                                     MenuDefUPP                userUPP);
  286.  
  287. #else
  288.     enum { uppMenuDefProcInfo = 0x0000FF80 };                         /* pascal no_return_value Func(2_bytes, 4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  289.     #define NewMenuDefUPP(userRoutine)                                 (MenuDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuDefProcInfo, GetCurrentArchitecture())
  290.     #define DisposeMenuDefUPP(userUPP)                                 DisposeRoutineDescriptor(userUPP)
  291.     #define InvokeMenuDefUPP(message, theMenu, menuRect, hitPt, whichItem, userUPP)  CALL_FIVE_PARAMETER_UPP((userUPP), uppMenuDefProcInfo, (message), (theMenu), (menuRect), (hitPt), (whichItem))
  292. #endif
  293. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  294. #define NewMenuDefProc(userRoutine)                             NewMenuDefUPP(userRoutine)
  295. #define CallMenuDefProc(userRoutine, message, theMenu, menuRect, hitPt, whichItem) InvokeMenuDefUPP(message, theMenu, menuRect, hitPt, whichItem, userRoutine)
  296. typedef CALLBACK_API( long , MenuBarDefProcPtr )(short selector, short message, short parameter1, long parameter2);
  297. typedef CALLBACK_API( void , MenuHookProcPtr )(void );
  298. typedef CALLBACK_API( short , MBarHookProcPtr )(Rect *menuRect);
  299. typedef STACK_UPP_TYPE(MenuBarDefProcPtr)                         MenuBarDefUPP;
  300. typedef STACK_UPP_TYPE(MenuHookProcPtr)                         MenuHookUPP;
  301. typedef STACK_UPP_TYPE(MBarHookProcPtr)                         MBarHookUPP;
  302. #if OPAQUE_UPP_TYPES
  303.     EXTERN_API(MenuBarDefUPP)
  304.     NewMenuBarDefUPP               (MenuBarDefProcPtr        userRoutine);
  305.  
  306.     EXTERN_API(MenuHookUPP)
  307.     NewMenuHookUPP                   (MenuHookProcPtr            userRoutine);
  308.  
  309.     EXTERN_API(MBarHookUPP)
  310.     NewMBarHookUPP                   (MBarHookProcPtr            userRoutine);
  311.  
  312.     EXTERN_API(void)
  313.     DisposeMenuBarDefUPP           (MenuBarDefUPP            userUPP);
  314.  
  315.     EXTERN_API(void)
  316.     DisposeMenuHookUPP               (MenuHookUPP                userUPP);
  317.  
  318.     EXTERN_API(void)
  319.     DisposeMBarHookUPP               (MBarHookUPP                userUPP);
  320.  
  321.     EXTERN_API(long)
  322.     InvokeMenuBarDefUPP               (short                    selector,
  323.                                     short                    message,
  324.                                     short                    parameter1,
  325.                                     long                    parameter2,
  326.                                     MenuBarDefUPP            userUPP);
  327.  
  328.     EXTERN_API(void)
  329.     InvokeMenuHookUPP               (MenuHookUPP                userUPP);
  330.  
  331.     EXTERN_API(short)
  332.     InvokeMBarHookUPP               (Rect *                    menuRect,
  333.                                     MBarHookUPP                userUPP);
  334.  
  335. #else
  336.     enum { uppMenuBarDefProcInfo = 0x00003AB0 };                     /* pascal 4_bytes Func(2_bytes, 2_bytes, 2_bytes, 4_bytes) */
  337.     enum { uppMenuHookProcInfo = 0x00000000 };                         /* pascal no_return_value Func() */
  338.     enum { uppMBarHookProcInfo = 0x000000CF };                         /* SPECIAL_CASE_PROCINFO(12) */
  339.     #define NewMenuBarDefUPP(userRoutine)                             (MenuBarDefUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuBarDefProcInfo, GetCurrentArchitecture())
  340.     #define NewMenuHookUPP(userRoutine)                             (MenuHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMenuHookProcInfo, GetCurrentArchitecture())
  341.     #define NewMBarHookUPP(userRoutine)                             (MBarHookUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppMBarHookProcInfo, GetCurrentArchitecture())
  342.     #define DisposeMenuBarDefUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  343.     #define DisposeMenuHookUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  344.     #define DisposeMBarHookUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  345.     #define InvokeMenuBarDefUPP(selector, message, parameter1, parameter2, userUPP)  (long)CALL_FOUR_PARAMETER_UPP((userUPP), uppMenuBarDefProcInfo, (selector), (message), (parameter1), (parameter2))
  346.     #define InvokeMenuHookUPP(userUPP)                                 CALL_ZERO_PARAMETER_UPP((userUPP), uppMenuHookProcInfo)
  347.     #define InvokeMBarHookUPP(menuRect, userUPP)                     (short)CALL_ONE_PARAMETER_UPP((userUPP), uppMBarHookProcInfo, (menuRect))
  348. #endif
  349. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  350. #define NewMenuBarDefProc(userRoutine)                             NewMenuBarDefUPP(userRoutine)
  351. #define NewMenuHookProc(userRoutine)                             NewMenuHookUPP(userRoutine)
  352. #define NewMBarHookProc(userRoutine)                             NewMBarHookUPP(userRoutine)
  353. #define CallMenuBarDefProc(userRoutine, selector, message, parameter1, parameter2) InvokeMenuBarDefUPP(selector, message, parameter1, parameter2, userRoutine)
  354. #define CallMenuHookProc(userRoutine)                            InvokeMenuHookUPP(userRoutine)
  355. #define CallMBarHookProc(userRoutine, menuRect)                    InvokeMBarHookUPP(menuRect, userRoutine)
  356. enum {
  357.     kMenuDefProcPtr                = 0                                /* raw proc-ptr access based on old MDEF */
  358. };
  359.  
  360.  
  361. typedef UInt32                             MenuDefType;
  362.  
  363. struct MenuDefSpec {
  364.     MenuDefType                     defType;
  365.     union {
  366.         MenuDefUPP                         defProc;
  367.     }                                 u;
  368. };
  369. typedef struct MenuDefSpec                MenuDefSpec;
  370. typedef MenuDefSpec *                    MenuDefSpecPtr;
  371. /*--------------------------------------------------------------------------------------*/
  372. /*    o Menu Manager Initialization                                                        */
  373. /*--------------------------------------------------------------------------------------*/
  374. EXTERN_API( void )
  375. InitProcMenu                    (short                     resID)                                ONEWORDINLINE(0xA808);
  376.  
  377. EXTERN_API( void )
  378. InitMenus                        (void)                                                        ONEWORDINLINE(0xA930);
  379.  
  380. /*--------------------------------------------------------------------------------------*/
  381. /*    o Menu Manipulation                                                                     */
  382. /*--------------------------------------------------------------------------------------*/
  383. EXTERN_API( MenuRef )
  384. NewMenu                            (MenuID                 menuID,
  385.                                  ConstStr255Param         menuTitle)                            ONEWORDINLINE(0xA931);
  386.  
  387. #if TARGET_OS_MAC
  388.     #define MacGetMenu GetMenu
  389. #endif
  390. EXTERN_API( MenuRef )
  391. MacGetMenu                        (short                     resourceID)                            ONEWORDINLINE(0xA9BF);
  392.  
  393. EXTERN_API( void )
  394. DisposeMenu                        (MenuRef                 theMenu)                            ONEWORDINLINE(0xA932);
  395.  
  396. EXTERN_API( void )
  397. CalcMenuSize                    (MenuRef                 theMenu)                            ONEWORDINLINE(0xA948);
  398.  
  399. EXTERN_API( short )
  400. CountMenuItems                    (MenuRef                 theMenu)                            ONEWORDINLINE(0xA950);
  401.  
  402. /* CountMItems() has been renamed to CountMenuItems() in Carbon */
  403. EXTERN_API( short )
  404. CountMItems                        (MenuRef                 theMenu)                            ONEWORDINLINE(0xA950);
  405.  
  406. #if CALL_NOT_IN_CARBON
  407. #define CountMenuItems( menu )  CountMItems( menu )
  408. #endif /* CALL_NOT_IN_CARBON */
  409.  
  410. /* Routines available in Mac OS 8.5 and later */
  411.  
  412. EXTERN_API( OSStatus )
  413. GetMenuFont                        (MenuRef                 menu,
  414.                                  SInt16 *                outFontID,
  415.                                  UInt16 *                outFontSize);
  416.  
  417. EXTERN_API( OSStatus )
  418. SetMenuFont                        (MenuRef                 menu,
  419.                                  SInt16                 inFontID,
  420.                                  UInt16                 inFontSize);
  421.  
  422. EXTERN_API( Boolean )
  423. GetMenuExcludesMarkColumn        (MenuRef                 menu);
  424.  
  425. EXTERN_API( OSStatus )
  426. SetMenuExcludesMarkColumn        (MenuRef                 menu,
  427.                                  Boolean                 excludesMark);
  428.  
  429. /* Routines available in Carbon only*/
  430.  
  431. EXTERN_API( OSStatus )
  432. RegisterMenuDefinition            (SInt16                 inResID,
  433.                                  MenuDefSpecPtr         inDefSpec);
  434.  
  435. EXTERN_API( OSStatus )
  436. CreateNewMenu                    (MenuID                 menuID,
  437.                                  MenuAttributes         menuAttributes,
  438.                                  MenuRef *                outMenuRef);
  439.  
  440. EXTERN_API( OSStatus )
  441. CreateCustomMenu                (const MenuDefSpec *    defSpec,
  442.                                  MenuID                 menuID,
  443.                                  MenuAttributes         menuAttributes,
  444.                                  MenuRef *                outMenuRef);
  445.  
  446. /*--------------------------------------------------------------------------------------*/
  447. /*    o Menu Item Insertion                                                                 */
  448. /*--------------------------------------------------------------------------------------*/
  449. #if TARGET_OS_MAC
  450.     #define MacAppendMenu AppendMenu
  451. #endif
  452. EXTERN_API( void )
  453. MacAppendMenu                    (MenuRef                 menu,
  454.                                  ConstStr255Param         data)                                ONEWORDINLINE(0xA933);
  455.  
  456. EXTERN_API( void )
  457. InsertResMenu                    (MenuRef                 theMenu,
  458.                                  ResType                 theType,
  459.                                  short                     afterItem)                            ONEWORDINLINE(0xA951);
  460.  
  461. EXTERN_API( void )
  462. AppendResMenu                    (MenuRef                 theMenu,
  463.                                  ResType                 theType)                            ONEWORDINLINE(0xA94D);
  464.  
  465. #if TARGET_OS_MAC
  466.     #define MacInsertMenuItem InsertMenuItem
  467. #endif
  468. EXTERN_API( void )
  469. MacInsertMenuItem                (MenuRef                 theMenu,
  470.                                  ConstStr255Param         itemString,
  471.                                  short                     afterItem)                            ONEWORDINLINE(0xA826);
  472.  
  473. EXTERN_API( void )
  474. DeleteMenuItem                    (MenuRef                 theMenu,
  475.                                  short                     item)                                ONEWORDINLINE(0xA952);
  476.  
  477. EXTERN_API( void )
  478. InsertFontResMenu                (MenuRef                 theMenu,
  479.                                  short                     afterItem,
  480.                                  short                     scriptFilter)                        THREEWORDINLINE(0x303C, 0x0400, 0xA825);
  481.  
  482. EXTERN_API( void )
  483. InsertIntlResMenu                (MenuRef                 theMenu,
  484.                                  ResType                 theType,
  485.                                  short                     afterItem,
  486.                                  short                     scriptFilter)                        THREEWORDINLINE(0x303C, 0x0601, 0xA825);
  487.  
  488. /* Routines available in Mac OS 8.5 and later*/
  489.  
  490. EXTERN_API( OSStatus )
  491. AppendMenuItemText                (MenuRef                 menu,
  492.                                  ConstStr255Param         inString);
  493.  
  494. EXTERN_API( OSStatus )
  495. InsertMenuItemText                (MenuRef                 menu,
  496.                                  ConstStr255Param         inString,
  497.                                  MenuItemIndex             afterItem);
  498.  
  499. /* Routines available in Carbon and later*/
  500.  
  501. /*--------------------------------------------------------------------------------------*/
  502. /*    o Menu Events                                                                         */
  503. /*--------------------------------------------------------------------------------------*/
  504. EXTERN_API( long )
  505. MenuKey                            (CharParameter             ch)                                    ONEWORDINLINE(0xA93E);
  506.  
  507. EXTERN_API( long )
  508. MenuSelect                        (Point                     startPt)                            ONEWORDINLINE(0xA93D);
  509.  
  510. EXTERN_API( long )
  511. PopUpMenuSelect                    (MenuRef                 menu,
  512.                                  short                     top,
  513.                                  short                     left,
  514.                                  short                     popUpItem)                            ONEWORDINLINE(0xA80B);
  515.  
  516. EXTERN_API( long )
  517. MenuChoice                        (void)                                                        ONEWORDINLINE(0xAA66);
  518.  
  519. /* Routines available in Mac OS 8.0 (Appearance 1.0) and later*/
  520. EXTERN_API( UInt32 )
  521. MenuEvent                        (const EventRecord *    inEvent)                            THREEWORDINLINE(0x303C, 0x020C, 0xA825);
  522.  
  523.  
  524. /*--------------------------------------------------------------------------------------*/
  525. /*    o Menu Bar                                                                               */
  526. /*--------------------------------------------------------------------------------------*/
  527. EXTERN_API( short )
  528. GetMBarHeight                    (void)                                                        TWOWORDINLINE(0x3EB8, 0x0BAA);
  529.  
  530. #if TARGET_OS_MAC
  531.     #define MacDrawMenuBar DrawMenuBar
  532. #endif
  533. EXTERN_API( void )
  534. MacDrawMenuBar                    (void)                                                        ONEWORDINLINE(0xA937);
  535.  
  536. EXTERN_API( void )
  537. InvalMenuBar                    (void)                                                        ONEWORDINLINE(0xA81D);
  538.  
  539. EXTERN_API( void )
  540. HiliteMenu                        (MenuID                 menuID)                                ONEWORDINLINE(0xA938);
  541.  
  542. EXTERN_API( Handle )
  543. GetNewMBar                        (short                     menuBarID)                            ONEWORDINLINE(0xA9C0);
  544.  
  545. EXTERN_API( Handle )
  546. GetMenuBar                        (void)                                                        ONEWORDINLINE(0xA93B);
  547.  
  548. EXTERN_API( void )
  549. SetMenuBar                        (Handle                 menuList)                            ONEWORDINLINE(0xA93C);
  550.  
  551. EXTERN_API( MenuRef )
  552. GetMenuHandle                    (MenuID                 menuID)                                ONEWORDINLINE(0xA949);
  553.  
  554. #if TARGET_OS_MAC
  555.     #define MacInsertMenu InsertMenu
  556. #endif
  557. EXTERN_API( void )
  558. MacInsertMenu                    (MenuRef                 theMenu,
  559.                                  MenuID                 beforeID)                            ONEWORDINLINE(0xA935);
  560.  
  561. #if TARGET_OS_MAC
  562.     #define MacDeleteMenu DeleteMenu
  563. #endif
  564. EXTERN_API( void )
  565. MacDeleteMenu                    (MenuID                 menuID)                                ONEWORDINLINE(0xA936);
  566.  
  567. EXTERN_API( void )
  568. ClearMenuBar                    (void)                                                        ONEWORDINLINE(0xA934);
  569.  
  570. EXTERN_API( void )
  571. SetMenuFlashCount                (short                     count)                                ONEWORDINLINE(0xA94A);
  572.  
  573. /* SetMenuFlash() has been renamed to SetMenuFlashCount() in Carbon */
  574. EXTERN_API( void )
  575. SetMenuFlash                    (short                     count)                                ONEWORDINLINE(0xA94A);
  576.  
  577. #if CALL_NOT_IN_CARBON
  578. #define SetMenuFlashCount( count )  SetMenuFlash( count )
  579. #endif /* CALL_NOT_IN_CARBON */
  580. EXTERN_API( void )
  581. FlashMenuBar                    (MenuID                 menuID)                                ONEWORDINLINE(0xA94C);
  582.  
  583. /* These are obsolete because Carbon does not support desk accessories.*/
  584. EXTERN_API( Boolean )
  585. SystemEdit                        (short                     editCmd)                            ONEWORDINLINE(0xA9C2);
  586.  
  587. EXTERN_API( void )
  588. SystemMenu                        (long                     menuResult)                            ONEWORDINLINE(0xA9B5);
  589.  
  590. /* Routines available in Mac OS 8.5 and later*/
  591. EXTERN_API( Boolean )
  592. IsMenuBarVisible                (void);
  593.  
  594. EXTERN_API( void )
  595. ShowMenuBar                        (void);
  596.  
  597. EXTERN_API( void )
  598. HideMenuBar                        (void);
  599.  
  600. /*--------------------------------------------------------------------------------------*/
  601. /*    o Menu Item Accessors                                                                 */
  602. /*--------------------------------------------------------------------------------------*/
  603. #if TARGET_OS_MAC
  604.     #define MacCheckMenuItem CheckMenuItem
  605. #endif
  606. EXTERN_API( void )
  607. MacCheckMenuItem                (MenuRef                 theMenu,
  608.                                  short                     item,
  609.                                  Boolean                 checked)                            ONEWORDINLINE(0xA945);
  610.  
  611. /* CheckItem() has been renamed to CheckMenuItem() in Carbon */
  612. EXTERN_API( void )
  613. CheckItem                        (MenuRef                 theMenu,
  614.                                  short                     item,
  615.                                  Boolean                 checked)                            ONEWORDINLINE(0xA945);
  616.  
  617. #if TARGET_OS_MAC && CALL_NOT_IN_CARBON
  618. #define CheckMenuItem( menu, item, checked ) CheckItem( menu, item, checked )
  619. #endif
  620. EXTERN_API( void )
  621. SetMenuItemText                    (MenuRef                 theMenu,
  622.                                  short                     item,
  623.                                  ConstStr255Param         itemString)                            ONEWORDINLINE(0xA947);
  624.  
  625. EXTERN_API( void )
  626. GetMenuItemText                    (MenuRef                 theMenu,
  627.                                  short                     item,
  628.                                  Str255                 itemString)                            ONEWORDINLINE(0xA946);
  629.  
  630. EXTERN_API( void )
  631. SetItemMark                        (MenuRef                 theMenu,
  632.                                  short                     item,
  633.                                  CharParameter             markChar)                            ONEWORDINLINE(0xA944);
  634.  
  635. EXTERN_API( void )
  636. GetItemMark                        (MenuRef                 theMenu,
  637.                                  short                     item,
  638.                                  CharParameter *        markChar)                            ONEWORDINLINE(0xA943);
  639.  
  640. EXTERN_API( void )
  641. SetItemCmd                        (MenuRef                 theMenu,
  642.                                  short                     item,
  643.                                  CharParameter             cmdChar)                            ONEWORDINLINE(0xA84F);
  644.  
  645. EXTERN_API( void )
  646. GetItemCmd                        (MenuRef                 theMenu,
  647.                                  short                     item,
  648.                                  CharParameter *        cmdChar)                            ONEWORDINLINE(0xA84E);
  649.  
  650. EXTERN_API( void )
  651. SetItemIcon                        (MenuRef                 theMenu,
  652.                                  short                     item,
  653.                                  short                     iconIndex)                            ONEWORDINLINE(0xA940);
  654.  
  655. /* icon is returned in high byte of 16-bit iconIndex */
  656. EXTERN_API( void )
  657. GetItemIcon                        (MenuRef                 theMenu,
  658.                                  short                     item,
  659.                                  short *                iconIndex)                            ONEWORDINLINE(0xA93F);
  660.  
  661. EXTERN_API( void )
  662. SetItemStyle                    (MenuRef                 theMenu,
  663.                                  short                     item,
  664.                                  StyleParameter         chStyle)                            ONEWORDINLINE(0xA942);
  665.  
  666. EXTERN_API( void )
  667. GetItemStyle                    (MenuRef                 theMenu,
  668.                                  short                     item,
  669.                                  Style *                chStyle);
  670.  
  671. /* These APIs are not supported in Carbon. Please use EnableMenuItem and */
  672. /* DisableMenuItem (available back through Mac OS 8.5) instead.          */
  673. EXTERN_API( void )
  674. DisableItem                        (MenuRef                 theMenu,
  675.                                  short                     item)                                ONEWORDINLINE(0xA93A);
  676.  
  677. EXTERN_API( void )
  678. EnableItem                        (MenuRef                 theMenu,
  679.                                  short                     item)                                ONEWORDINLINE(0xA939);
  680.  
  681. /* Routines available in Mac OS 8.0 (Appearance 1.0) and later*/
  682.  
  683. EXTERN_API( OSErr )
  684. SetMenuItemCommandID            (MenuRef                 inMenu,
  685.                                  SInt16                 inItem,
  686.                                  MenuCommand             inCommandID)                        THREEWORDINLINE(0x303C, 0x0502, 0xA825);
  687.  
  688. EXTERN_API( OSErr )
  689. GetMenuItemCommandID            (MenuRef                 inMenu,
  690.                                  SInt16                 inItem,
  691.                                  MenuCommand *            outCommandID)                        THREEWORDINLINE(0x303C, 0x0503, 0xA825);
  692.  
  693. EXTERN_API( OSErr )
  694. SetMenuItemModifiers            (MenuRef                 inMenu,
  695.                                  SInt16                 inItem,
  696.                                  UInt8                     inModifiers)                        THREEWORDINLINE(0x303C, 0x0404, 0xA825);
  697.  
  698. EXTERN_API( OSErr )
  699. GetMenuItemModifiers            (MenuRef                 inMenu,
  700.                                  SInt16                 inItem,
  701.                                  UInt8 *                outModifiers)                        THREEWORDINLINE(0x303C, 0x0505, 0xA825);
  702.  
  703. EXTERN_API( OSErr )
  704. SetMenuItemIconHandle            (MenuRef                 inMenu,
  705.                                  SInt16                 inItem,
  706.                                  UInt8                     inIconType,
  707.                                  Handle                 inIconHandle)                        THREEWORDINLINE(0x303C, 0x0606, 0xA825);
  708.  
  709. EXTERN_API( OSErr )
  710. GetMenuItemIconHandle            (MenuRef                 inMenu,
  711.                                  SInt16                 inItem,
  712.                                  UInt8 *                outIconType,
  713.                                  Handle *                outIconHandle)                        THREEWORDINLINE(0x303C, 0x0707, 0xA825);
  714.  
  715. EXTERN_API( OSErr )
  716. SetMenuItemTextEncoding            (MenuRef                 inMenu,
  717.                                  SInt16                 inItem,
  718.                                  TextEncoding             inScriptID)                            THREEWORDINLINE(0x303C, 0x0408, 0xA825);
  719.  
  720. EXTERN_API( OSErr )
  721. GetMenuItemTextEncoding            (MenuRef                 inMenu,
  722.                                  SInt16                 inItem,
  723.                                  TextEncoding *            outScriptID)                        THREEWORDINLINE(0x303C, 0x0509, 0xA825);
  724.  
  725. EXTERN_API( OSErr )
  726. SetMenuItemHierarchicalID        (MenuRef                 inMenu,
  727.                                  SInt16                 inItem,
  728.                                  MenuID                 inHierID)                            THREEWORDINLINE(0x303C, 0x040D, 0xA825);
  729.  
  730. EXTERN_API( OSErr )
  731. GetMenuItemHierarchicalID        (MenuRef                 inMenu,
  732.                                  SInt16                 inItem,
  733.                                  MenuID *                outHierID)                            THREEWORDINLINE(0x303C, 0x050E, 0xA825);
  734.  
  735. EXTERN_API( OSErr )
  736. SetMenuItemFontID                (MenuRef                 inMenu,
  737.                                  SInt16                 inItem,
  738.                                  SInt16                 inFontID)                            THREEWORDINLINE(0x303C, 0x040F, 0xA825);
  739.  
  740. EXTERN_API( OSErr )
  741. GetMenuItemFontID                (MenuRef                 inMenu,
  742.                                  SInt16                 inItem,
  743.                                  SInt16 *                outFontID)                            THREEWORDINLINE(0x303C, 0x0510, 0xA825);
  744.  
  745. EXTERN_API( OSErr )
  746. SetMenuItemRefCon                (MenuRef                 inMenu,
  747.                                  SInt16                 inItem,
  748.                                  UInt32                 inRefCon)                            THREEWORDINLINE(0x303C, 0x050A, 0xA825);
  749.  
  750. EXTERN_API( OSErr )
  751. GetMenuItemRefCon                (MenuRef                 inMenu,
  752.                                  SInt16                 inItem,
  753.                                  UInt32 *                outRefCon)                            THREEWORDINLINE(0x303C, 0x050B, 0xA825);
  754.  
  755. /* Please use the menu item property APIs in Carbon.*/
  756. EXTERN_API( OSErr )
  757. SetMenuItemRefCon2                (MenuRef                 inMenu,
  758.                                  SInt16                 inItem,
  759.                                  UInt32                 inRefCon2)                            THREEWORDINLINE(0x303C, 0x0511, 0xA825);
  760.  
  761. EXTERN_API( OSErr )
  762. GetMenuItemRefCon2                (MenuRef                 inMenu,
  763.                                  SInt16                 inItem,
  764.                                  UInt32 *                outRefCon2)                            THREEWORDINLINE(0x303C, 0x0512, 0xA825);
  765.  
  766. EXTERN_API( OSErr )
  767. SetMenuItemKeyGlyph                (MenuRef                 inMenu,
  768.                                  SInt16                 inItem,
  769.                                  SInt16                 inGlyph)                            THREEWORDINLINE(0x303C, 0x0513, 0xA825);
  770.  
  771. EXTERN_API( OSErr )
  772. GetMenuItemKeyGlyph                (MenuRef                 inMenu,
  773.                                  SInt16                 inItem,
  774.                                  SInt16 *                outGlyph)                            THREEWORDINLINE(0x303C, 0x0514, 0xA825);
  775.  
  776. /* Routines available in Mac OS 8.5 and later (supporting enabling/disabling of > 31 items)*/
  777.  
  778. #if TARGET_OS_MAC
  779.     #define MacEnableMenuItem EnableMenuItem
  780. #endif
  781. EXTERN_API( void )
  782. MacEnableMenuItem                (MenuRef                 theMenu,
  783.                                  MenuItemIndex             item);
  784.  
  785. EXTERN_API( void )
  786. DisableMenuItem                    (MenuRef                 theMenu,
  787.                                  MenuItemIndex             item);
  788.  
  789. EXTERN_API( Boolean )
  790. IsMenuItemEnabled                (MenuRef                 menu,
  791.                                  MenuItemIndex             item);
  792.  
  793. EXTERN_API( void )
  794. EnableMenuItemIcon                (MenuRef                 theMenu,
  795.                                  MenuItemIndex             item)                                THREEWORDINLINE(0x303C, 0x0019, 0xA825);
  796.  
  797. EXTERN_API( void )
  798. DisableMenuItemIcon                (MenuRef                 theMenu,
  799.                                  MenuItemIndex             item)                                THREEWORDINLINE(0x303C, 0x0020, 0xA825);
  800.  
  801. EXTERN_API( Boolean )
  802. IsMenuItemIconEnabled            (MenuRef                 menu,
  803.                                  MenuItemIndex             item)                                THREEWORDINLINE(0x303C, 0x0018, 0xA825);
  804.  
  805. /*--------------------------------------------------------------------------------------*/
  806. /*    o Menu Item Color Tables                                                             */
  807. /*                                                                                          */
  808. /*    Menu color manipulation is considered deprecated with the advent of the Appearance    */
  809. /*    Manager.  Avoid using these routines if possible                                     */
  810. /*--------------------------------------------------------------------------------------*/
  811. EXTERN_API( void )
  812. DeleteMCEntries                    (MenuID                 menuID,
  813.                                  short                     menuItem)                            ONEWORDINLINE(0xAA60);
  814.  
  815. EXTERN_API( MCTableHandle )
  816. GetMCInfo                        (void)                                                        ONEWORDINLINE(0xAA61);
  817.  
  818. EXTERN_API( void )
  819. SetMCInfo                        (MCTableHandle             menuCTbl)                            ONEWORDINLINE(0xAA62);
  820.  
  821. EXTERN_API( void )
  822. DisposeMCInfo                    (MCTableHandle             menuCTbl)                            ONEWORDINLINE(0xAA63);
  823.  
  824. EXTERN_API( MCEntryPtr )
  825. GetMCEntry                        (MenuID                 menuID,
  826.                                  short                     menuItem)                            ONEWORDINLINE(0xAA64);
  827.  
  828. EXTERN_API( void )
  829. SetMCEntries                    (short                     numEntries,
  830.                                  MCTablePtr             menuCEntries)                        ONEWORDINLINE(0xAA65);
  831.  
  832.  
  833. /*--------------------------------------------------------------------------------------*/
  834. /* o Properties     (Mac OS 8.5 and later)                                                    */
  835. /*                                                                                        */
  836. /* With the following property APIs, you can attach any piece of data you'd like to a    */
  837. /* menu or menu item. Passing zero for the item number parameter indicates you'd like    */
  838. /* to attach the data to the menu itself, and not to any specific menu item.            */
  839. /*--------------------------------------------------------------------------------------*/
  840. enum {
  841.     kMenuPropertyPersistent        = 0x00000001                    /* whether this property gets saved when flattening the menu*/
  842. };
  843.  
  844. EXTERN_API( OSStatus )
  845. GetMenuItemProperty                (MenuRef                 menu,
  846.                                  MenuItemIndex             item,
  847.                                  OSType                 propertyCreator,
  848.                                  OSType                 propertyTag,
  849.                                  UInt32                 bufferSize,
  850.                                  UInt32 *                actualSize,
  851.                                  void *                    propertyBuffer);
  852.  
  853. EXTERN_API( OSStatus )
  854. GetMenuItemPropertySize            (MenuRef                 menu,
  855.                                  MenuItemIndex             item,
  856.                                  OSType                 propertyCreator,
  857.                                  OSType                 propertyTag,
  858.                                  UInt32 *                size);
  859.  
  860. EXTERN_API( OSStatus )
  861. SetMenuItemProperty                (MenuRef                 menu,
  862.                                  MenuItemIndex             item,
  863.                                  OSType                 propertyCreator,
  864.                                  OSType                 propertyTag,
  865.                                  UInt32                 propertySize,
  866.                                  const void *            propertyData);
  867.  
  868. EXTERN_API( OSStatus )
  869. RemoveMenuItemProperty            (MenuRef                 menu,
  870.                                  MenuItemIndex             item,
  871.                                  OSType                 propertyCreator,
  872.                                  OSType                 propertyTag);
  873.  
  874. EXTERN_API( OSStatus )
  875. GetMenuItemPropertyAttributes    (MenuRef                 menu,
  876.                                  MenuItemIndex             item,
  877.                                  OSType                 propertyCreator,
  878.                                  OSType                 propertyTag,
  879.                                  UInt32 *                attributes);
  880.  
  881. EXTERN_API( OSStatus )
  882. ChangeMenuItemPropertyAttributes (MenuRef                 menu,
  883.                                  MenuItemIndex             item,
  884.                                  OSType                 propertyCreator,
  885.                                  OSType                 propertyTag,
  886.                                  UInt32                 attributesToSet,
  887.                                  UInt32                 attributesToClear);
  888.  
  889. /*--------------------------------------------------------------------------------------*/
  890. /*    o Attributes (Carbon and later)                                                        */
  891. /*                                                                                        */
  892. /*    Each menu and menu item has attribute flags.                                        */
  893. /*--------------------------------------------------------------------------------------*/
  894. EXTERN_API( OSStatus )
  895. GetMenuAttributes                (MenuRef                 menu,
  896.                                  MenuAttributes *        outAttributes);
  897.  
  898. EXTERN_API( OSStatus )
  899. ChangeMenuAttributes            (MenuRef                 menu,
  900.                                  MenuAttributes         setTheseAttributes,
  901.                                  MenuAttributes         clearTheseAttributes);
  902.  
  903. EXTERN_API( OSStatus )
  904. GetMenuItemAttributes            (MenuRef                 menu,
  905.                                  MenuItemIndex             item,
  906.                                  MenuItemAttributes *    outAttributes);
  907.  
  908. EXTERN_API( OSStatus )
  909. ChangeMenuItemAttributes        (MenuRef                 menu,
  910.                                  MenuItemIndex             item,
  911.                                  MenuItemAttributes     setTheseAttributes,
  912.                                  MenuItemAttributes     clearTheseAttributes);
  913.  
  914. /*--------------------------------------------------------------------------------------*/
  915. /*    o Mass menu item enabling and disabling (Carbon and later)                            */
  916. /*                                                                                        */
  917. /*    Useful when rewriting code that whacks the enableFlags field directly.                */
  918. /*--------------------------------------------------------------------------------------*/
  919. EXTERN_API( void )
  920. DisableAllMenuItems                (MenuRef                 theMenu);
  921.  
  922. EXTERN_API( void )
  923. EnableAllMenuItems                (MenuRef                 theMenu);
  924.  
  925. EXTERN_API( Boolean )
  926. MenuHasEnabledItems                (MenuRef                 theMenu);
  927.  
  928. /*--------------------------------------------------------------------------------------*/
  929. /*    o Menu tracking status (Carbon and later)                                            */
  930. /*                                                                                        */
  931. /*    Get info about the selected menu item during menu tracking. Replaces direct access    */
  932. /*    to low-mem globals that used to hold this info.                                        */
  933. /*--------------------------------------------------------------------------------------*/
  934. EXTERN_API( OSStatus )
  935. GetMenuTrackingData                (MenuRef                 theMenu,
  936.                                  MenuTrackingData *        outData);
  937.  
  938. /*--------------------------------------------------------------------------------------*/
  939. /*    o.Universal command ID access (Carbon and later)                                    */
  940. /*                                                                                        */
  941. /*    These APIs allow you to operate on menu items strictly by command ID, with no        */
  942. /*    knowledge of a menu item's index.                                                    */
  943. /*--------------------------------------------------------------------------------------*/
  944. EXTERN_API( ItemCount )
  945. CountMenuItemsWithCommandID        (MenuRef                 menu,
  946.                                  MenuCommand             commandID);
  947.  
  948. EXTERN_API( OSStatus )
  949. GetIndMenuItemWithCommandID        (MenuRef                 menu,
  950.                                  MenuCommand             commandID,
  951.                                  UInt32                 itemIndex,
  952.                                  MenuRef *                outMenu,
  953.                                  MenuItemIndex *        outIndex);
  954.  
  955. EXTERN_API( void )
  956. EnableMenuCommand                (MenuRef                 theMenu,
  957.                                  MenuCommand             commandID);
  958.  
  959. EXTERN_API( void )
  960. DisableMenuCommand                (MenuRef                 theMenu,
  961.                                  MenuCommand             commandID);
  962.  
  963. EXTERN_API( Boolean )
  964. IsMenuCommandEnabled            (MenuRef                 menu,
  965.                                  MenuCommand             commandID);
  966.  
  967. EXTERN_API( OSStatus )
  968. GetMenuCommandProperty            (MenuRef                 menu,
  969.                                  MenuCommand             commandID,
  970.                                  OSType                 propertyCreator,
  971.                                  OSType                 propertyTag,
  972.                                  ByteCount                 bufferSize,
  973.                                  ByteCount *            actualSize,
  974.                                  void *                    propertyBuffer);
  975.  
  976. EXTERN_API( OSStatus )
  977. GetMenuCommandPropertySize        (MenuRef                 menu,
  978.                                  MenuCommand             commandID,
  979.                                  OSType                 propertyCreator,
  980.                                  OSType                 propertyTag,
  981.                                  ByteCount *            size);
  982.  
  983. EXTERN_API( OSStatus )
  984. SetMenuCommandProperty            (MenuRef                 menu,
  985.                                  MenuCommand             commandID,
  986.                                  OSType                 propertyCreator,
  987.                                  OSType                 propertyTag,
  988.                                  ByteCount                 propertySize,
  989.                                  const void *            propertyData);
  990.  
  991. EXTERN_API( OSStatus )
  992. RemoveMenuCommandProperty        (MenuRef                 menu,
  993.                                  MenuCommand             commandID,
  994.                                  OSType                 propertyCreator,
  995.                                  OSType                 propertyTag);
  996.  
  997.  
  998. /*--------------------------------------------------------------------------------------*/
  999. /*    o.Standard font menu (Carbon and later)                                                */
  1000. /*                                                                                        */
  1001. /*    These APIs allow you to create and use the standard font menu.                        */
  1002. /*--------------------------------------------------------------------------------------*/
  1003. enum {
  1004.     kHierarchicalFontMenuOption    = 0x00000001
  1005. };
  1006.  
  1007. EXTERN_API( OSStatus )
  1008. CreateStandardFontMenu            (MenuRef                 menu,
  1009.                                  MenuItemIndex             afterItem,
  1010.                                  MenuID                 firstHierMenuID,
  1011.                                  OptionBits             options,
  1012.                                  ItemCount *            outHierMenuCount);
  1013.  
  1014. EXTERN_API( OSStatus )
  1015. UpdateStandardFontMenu            (MenuRef                 menu,
  1016.                                  ItemCount *            outHierMenuCount);
  1017.  
  1018. EXTERN_API( OSStatus )
  1019. GetFontFamilyFromMenuSelection    (MenuRef                 menu,
  1020.                                  MenuItemIndex             item,
  1021.                                  FMFontFamily *            outFontFamily,
  1022.                                  FMFontStyle *            outStyle);
  1023.  
  1024. /*--------------------------------------------------------------------------------------*/
  1025. /*    o Contextual Menu routines and constants                                            */
  1026. /*    available with Conxtextual Menu extension 1.0 and later                                */
  1027. /*--------------------------------------------------------------------------------------*/
  1028. /* Gestalt Selector for classic 68K apps only. */
  1029. /* CFM apps should weak link and check the symbols. */
  1030. enum {
  1031.     gestaltContextualMenuAttr    = FOUR_CHAR_CODE('cmnu'),
  1032.     gestaltContextualMenuUnusedBit = 0,
  1033.     gestaltContextualMenuTrapAvailable = 1
  1034. };
  1035.  
  1036. /* Values indicating what kind of help the application supports */
  1037. enum {
  1038.     kCMHelpItemNoHelp            = 0,
  1039.     kCMHelpItemAppleGuide        = 1,
  1040.     kCMHelpItemOtherHelp        = 2
  1041. };
  1042.  
  1043. /* Values indicating what was chosen from the menu */
  1044. enum {
  1045.     kCMNothingSelected            = 0,
  1046.     kCMMenuItemSelected            = 1,
  1047.     kCMShowHelpSelected            = 3
  1048. };
  1049.  
  1050. EXTERN_API( OSStatus )
  1051. InitContextualMenus                (void)                                                        TWOWORDINLINE(0x7001, 0xAA72);
  1052.  
  1053. EXTERN_API( Boolean )
  1054. IsShowContextualMenuClick        (const EventRecord *    inEvent)                            TWOWORDINLINE(0x7002, 0xAA72);
  1055.  
  1056. EXTERN_API( OSStatus )
  1057. ContextualMenuSelect            (MenuRef                 inMenu,
  1058.                                  Point                     inGlobalLocation,
  1059.                                  Boolean                 inReserved,
  1060.                                  UInt32                 inHelpType,
  1061.                                  ConstStr255Param         inHelpItemString,
  1062.                                  const AEDesc *            inSelection,
  1063.                                  UInt32 *                outUserSelectionType,
  1064.                                  SInt16 *                outMenuID,
  1065.                                  MenuItemIndex *        outMenuItem)                        TWOWORDINLINE(0x7003, 0xAA72);
  1066.  
  1067. EXTERN_API( Boolean )
  1068. ProcessIsContextualMenuClient    (ProcessSerialNumber *    inPSN)                                TWOWORDINLINE(0x7004, 0xAA72);
  1069.  
  1070.  
  1071. /*--------------------------------------------------------------------------------------*/
  1072. /*    o Contextual Menu Plugin Notes                                                        */
  1073. /*                                                                                        */
  1074. /*    For Mac OS X, we will support a new type of Contextual Menu Plugin: the CFM-based      */
  1075. /*    plugin. Each plugin must be a separate file in the Contextual Menu Items subfolder    */
  1076. /*    of the system folder. It must export two functions and has the option of exporting    */
  1077. /*    a third; these three functions are virtually identical to the methods that must be    */
  1078. /*    supported by a SOM-based plugin.                                                        */
  1079. /*                                                                                        */
  1080. /*    The required symbols must be named "ExamineContext" and "HandleSelection".            */
  1081. /*    The optional symbol must be named "PostMenuCleanup".                                */
  1082. /*                                                                                        */
  1083. /*    The ExamineContext routine must have the following prototype:                        */
  1084. /*        pascal OSStatus ExamineContext(    const AEDesc* inContext,                        */
  1085. /*                                        AEDescList* outCommandPairs );                    */
  1086. /*                                                                                        */
  1087. /*    The HandleSelection routine must have the following prototype:                        */
  1088. /*        pascal OSStatus HandleSelection(     const AEDesc* inContext,                    */
  1089. /*                                            SInt32 inCommandID );                        */
  1090. /*                                                                                        */
  1091. /*    The PostMenuCleanup routine must have the following prototype:                        */
  1092. /*        pascal void PostMenuCleanup(     void );                                            */
  1093. /*--------------------------------------------------------------------------------------*/
  1094.  
  1095. EXTERN_API_C( MenuRef )
  1096. newmenu                            (MenuID                 menuID,
  1097.                                  const char *            menuTitle);
  1098.  
  1099. EXTERN_API_C( void )
  1100. appendmenu                        (MenuRef                 menu,
  1101.                                  const char *            data);
  1102.  
  1103. EXTERN_API_C( void )
  1104. insertmenuitem                    (MenuRef                 theMenu,
  1105.                                  const char *            itemString,
  1106.                                  short                     afterItem);
  1107.  
  1108. EXTERN_API_C( long )
  1109. menuselect                        (const Point *            startPt);
  1110.  
  1111. EXTERN_API_C( void )
  1112. setmenuitemtext                    (MenuRef                 menu,
  1113.                                  short                     item,
  1114.                                  const char *            itemString);
  1115.  
  1116. EXTERN_API_C( void )
  1117. getmenuitemtext                    (MenuRef                 menu,
  1118.                                  short                     item,
  1119.                                  char *                    itemString);
  1120.  
  1121. #if OLDROUTINENAMES
  1122. #define AddResMenu(theMenu, theType) AppendResMenu(theMenu, theType)
  1123. #define InsMenuItem(theMenu, itemString, afterItem)    InsertMenuItem(theMenu, itemString, afterItem)
  1124. #define DelMenuItem( theMenu, item ) DeleteMenuItem( theMenu, item )
  1125. #if TARGET_OS_MAC
  1126. #define SetItem MacSetItem
  1127. #define GetItem MacGetItem
  1128. #endif
  1129. #define MacSetItem(theMenu, item, itemString) SetMenuItemText(theMenu, item, itemString)
  1130. #define MacGetItem(theMenu, item, itemString) GetMenuItemText(theMenu, item, itemString)
  1131. #define GetMHandle(menuID) GetMenuHandle(menuID)
  1132. #define DelMCEntries(menuID, menuItem) DeleteMCEntries(menuID, menuItem)
  1133. #define DispMCInfo(menuCTbl) DisposeMCInfo(menuCTbl)
  1134. #if CALL_NOT_IN_CARBON
  1135. #define addresmenu(menu, data) appendresmenu(menu, data)
  1136. #define getitem(menu, item, itemString) getmenuitemtext(menu, item, itemString)
  1137. #define setitem(menu, item, itemString) setmenuitemtext(menu, item, itemString)
  1138. #define insmenuitem(theMenu, itemString, afterItem)    insertmenuitem(theMenu, itemString, afterItem)
  1139. #endif
  1140. #endif  /* OLDROUTINENAMES */
  1141.  
  1142. #if ACCESSOR_CALLS_ARE_FUNCTIONS
  1143. /* Getters */
  1144. EXTERN_API( MenuID )
  1145. GetMenuID                        (MenuRef                 menu);
  1146.  
  1147. EXTERN_API( SInt16 )
  1148. GetMenuWidth                    (MenuRef                 menu);
  1149.  
  1150. EXTERN_API( SInt16 )
  1151. GetMenuHeight                    (MenuRef                 menu);
  1152.  
  1153. EXTERN_API( StringPtr )
  1154. GetMenuTitle                    (MenuRef                 menu,
  1155.                                  Str255                 title);
  1156.  
  1157. EXTERN_API( OSStatus )
  1158. GetMenuDefinition                (MenuRef                 menu,
  1159.                                  MenuDefSpecPtr         outDefSpec);
  1160.  
  1161. /* Setters */
  1162. EXTERN_API( void )
  1163. SetMenuID                        (MenuRef                 menu,
  1164.                                  MenuID                 menuID);
  1165.  
  1166. EXTERN_API( void )
  1167. SetMenuWidth                    (MenuRef                 menu,
  1168.                                  SInt16                 width);
  1169.  
  1170. EXTERN_API( void )
  1171. SetMenuHeight                    (MenuRef                 menu,
  1172.                                  SInt16                 height);
  1173.  
  1174. EXTERN_API( OSStatus )
  1175. SetMenuTitle                    (MenuRef                 menu,
  1176.                                  ConstStr255Param         title);
  1177.  
  1178. EXTERN_API( OSStatus )
  1179. SetMenuDefinition                (MenuRef                 menu,
  1180.                                  const MenuDefSpec *    defSpec);
  1181.  
  1182. #endif  /* ACCESSOR_CALLS_ARE_FUNCTIONS */
  1183.  
  1184.  
  1185.  
  1186. #if TARGET_OS_WIN32
  1187. #endif  /* TARGET_OS_WIN32 */
  1188.  
  1189.  
  1190. #if PRAGMA_STRUCT_ALIGN
  1191.     #pragma options align=reset
  1192. #elif PRAGMA_STRUCT_PACKPUSH
  1193.     #pragma pack(pop)
  1194. #elif PRAGMA_STRUCT_PACK
  1195.     #pragma pack()
  1196. #endif
  1197.  
  1198. #ifdef PRAGMA_IMPORT_OFF
  1199. #pragma import off
  1200. #elif PRAGMA_IMPORT
  1201. #pragma import reset
  1202. #endif
  1203.  
  1204. #ifdef __cplusplus
  1205. }
  1206. #endif
  1207.  
  1208. #endif /* __MENUS__ */
  1209.  
  1210.